<template>
  <!-- 消息  --  通知公告/系统消息  --  详情页 -->
  <view class="messagesDetail">
    <view class="wrapper">
      <view class="title">{{ details.title || "" }}</view>
      <view class="createTime">发布时间：{{ details.createTime || "" }}</view>
      <view
        class="content"
        style="white-space: pre-wrap"
        v-html="details.content"
      >
      </view>
    </view>
  </view>
</template>

<script>
import { importantReminderDetail } from "@/api/home.js";
import { homePageDetail } from "@/api/messages.js";

export default {
  data() {
    return {
      baseImgUrl: this.$baseImgUrl,
      options: "",
      details: {},
    };
  },
  onLoad(options) {
    this.options = options;
    this.getDetail();
  },
  methods: {
    getDetail() {
      // if (this.options.flag) {
      //   importantReminderDetail({
      //     id: this.options.id,
      //   }).then((res) => {
      //     this.details = res.result;
      //   });
      //   return;
      // }

      homePageDetail({
        id: this.options.id,
        noticeType: this.options.noticeType,
      }).then((res) => {
        this.details = res.result;
        this.details.content = res.result.content.replace(
          /img/g,
          'img style="max-width:100%;height:auto"'
        );
      });
    },
  },
};
</script>

<style lang="scss">
.messagesDetail {
  height: 100%;
  background: #f6f6f6;
  overflow-y: auto;
  padding: 16rpx 24rpx;
  .wrapper {
    height: auto;
    min-height: 100%;
    background: #fff;
    padding: 34rpx 40rpx 0;

    .title {
      padding-bottom: 27rpx;
      text-align: center;
      font-size: 30rpx;
      font-family: PingFang SC;
      font-weight: bold;
      color: #000000;
    }

    .createTime {
      padding-bottom: 27rpx;
      text-align: center;
      font-size: 28rpx;
      font-family: PingFang SC;
      font-weight: 400;
      color: #999999;
    }

    .content {
      padding-bottom: 40rpx;
      font-size: 2r8px;
      font-family: PingFang SC;
      font-weight: 400;
      color: #000000;
    }
  }
}
</style>
